package com.cgg.stock.deal.controller;

import com.cgg.stock.common.pojo.TradeOrder;
import com.cgg.stock.common.util.ResponseData;
import com.cgg.stock.common.util.ResponseDataUtil;
import com.cgg.stock.deal.service.IDealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 处理撮合成交的订单
 * @Date: 2023/2/16 16:01
 * @Author: SinkDream
 */
@RestController
@RequestMapping("/deal")
public class DealController {
    @Autowired
    private IDealService dealService;

    @PostMapping("/dealOrders")
    public ResponseData dealOrder(@RequestBody List<TradeOrder> tradeOrders) throws Exception {
        dealService.dealOrder(tradeOrders);
        return ResponseDataUtil.buildOk("交易完成");
    }
}
